A-3 WiseVIEW OLE Automation
Through OLE Automation you can integrate WiseVIEW with other system and use it as OLE Server. You can also easily control WiseVIEW application.
Name used in client of OLE Automation for connecting WiseVIEW
"WiseVIEW.document"
It consists of total 8 Methods listed below
- short ShowWindow();
- short LoadFile(LPCTSTR filename);
- short ProtectFile(LPCTSTR filename);
- short SetReadOption(short readflag);
- short SearchString(LPCTSTR str, short addflag, short caseflag);
- short SetHeader(LPCTSTR comment);
- BOOL SetFooter(LPCTSTR footer);
- BOOL SendMessage(LPCTSTR Command);
1. WiseVIEW OLE Automation Method
ShowWindow
Declaration:
short ShowWindow();
Description:
This Method is used for showing WiseVIEW window.
LoadFile
Declaration:
short LoadFile (LPCTSTR fileName);
Arguments:
fileName: name of the file you want to open
Description: This Method is used for reading the specific file and closes the previously opened file. If it reads the corresponding file correctly, return TRUE, and if not, return FAlSE
ProtectFile
Declaration:
short ProtectFile (LPCTSTR fileName);
Arguments:
fileName: name of the file you want to open with Protect Mode.
Description: This Method is used for reading the specific file with Protect Mode. You cannot copy or delete file, and if WiseVIEW gets shut down or another file is read, current file gets deleted.
SetReadOnly
Declaration:
short SetReadOption (short readflag);
Arguments:
readflag: it is a kind of variable that decides whether the current file should be set up as read only file or not. If TRUE, it sets up as read only, and if FALSE, it cancels read only.
Description: This Method is used for setting up current file as read only file. If file gets fixed as read only, you cannot save or print.
Search
Declaration:
short SearchString(LPCTSTR str, short addflag, short caseflag);
Arguments:
str: specific word that you want to search
addflag: flag that decides whether previously searched word should be searched again or not.
caseflag: flag that decides whether word should be classified for capital letter and small letter or not.
Description: This Method is used for searching the specific word without activating Search dialog
SetHeader
Declaration:
short SetHeader (LPCTSTR header);
Arguments:
header: text of header
Description:
This Method is used for setting the text of header
SetFooter
Declaration:
BOOL SetFooter(LPCTSTR footer);
Arguments:
Footer: text for footer
Description:
This Method is used for setting the text of footer
SendMessage
Declaration:
BOOL SendMessage(LPCTSTR Command);
Arguments:
Command: String value to control menus.
2. Samples of WiseVIEW OLE Automation
2-1. Visual C++ 4.0
- interface\ole\vc\OLETest.mdp
Step 1) Creating application
Create application of Dialog based type with MFC AppWizard
Step 2) Adding WiseVIEW Type Library
Add WiseVIEW.tlb file in bin directory of WiseVIEW installation directory through From an OLE Typlib in Add Class button of ClassWizard.
Class of IWiseVIEW gets created.(wiseview.h, WiseVIEW.cpp)
Step 3) Creating and declaring WiseVIEW OLE Automation objects.
#include "WiseVIEW.h" ///OLETestDlg.h
class COLETestDlg : public Cdialog
{
...
IWiseVIEW m_WiseVIEW;
...
}
BOOL COLETestDlg::OnInitDialog() //OLETestDlg.cpp
{
...
COleException* pError=NULL;
if (!m_WiseVIEW.CreateDispatch(_T("WiseVIEW.Document"),pError))
{
AfxMessageBox("WiseVIEW is impracticable!");
}
...
}
Step 4) Sample of WiseVIEW OLE Automation object control
OLETest performance file creats WiseVIEW OLE object when initiated for the first time.
Select Method. Set corresponding variable and control object by pressing Operate button.
2-2. Visual Basic 5.0
- interface\ole\vb\OLETest.vbp
The way of creating and declaring WiseVIEW OLE Automation object is as follows. For Visual Basic, you don't have to add separate library file.
Dim SERVER As Object //Declare Object
Set SERVER = CreateObject("WiseVIEW.Document") //Create Object